package com.example.forum.common;

public enum ResultCode {
    /* 定义状态码 */

    SUCCESS(200, "成功"),
    FAILED(1000, "操作失败"),
    FAILED_UNAUTHORIZED(1001, "未授权"),
    FAILED_PARAMS_VALIDATE(1002, "参数校验失败"),
    FAILED_FORBIDDEN(1003, "禁止访问"),
    FAILED_CREATE(1004, "新增失败"),
    FAILED_NOT_EXISTS(1005, "资源不存在"),

    //用户相关
    AILED_USER_EXISTS(1101, "用户已存在"),
    FAILED_USER_NOT_EXISTS(1102, "用户不存在"),
    FAILED_LOGIN(1103, "用户名或密码错误"),
    FAILED_USER_BANNED(1104, "您已被禁言，请联系管理员"),
    FAILED_TWO_PWD_NOT_SAME(1105, "两次输入的密码不一致"),
    FAILED_USER_NOT_EXIST(1106,"找不到该用户,用户号不存在"),
    FAILED_USER_ARTICLE_DELETE(1107,"删除该人员帖子失败"),
    FAILED_USER_INFO_MODIFY(1108,"信息没有被更新,无需修改"),
    FAILED_USER_INFO_UPDATE(1109,"用户信息修改失败"),
    FAILED_OLD_PASSWORD(1110,"旧密码输入错误!"),
    FAILED_UPDATE_PASSWORD(1111,"更新密码失败!"),
    PASSWORD_NOT_SAFE(1112,"密码安全系数不够,请至少输入六位!"),
    EMAIL_FORMAT_ERROR(1113,"邮箱格式错误!"),
    PHONE_FORMAT_ERROR(1114,"手机号格式错误!"),


    //板块相关
    FAILED_BOARD_ARTICLE_COUNT(1201,"更新帖子数量失败"),
    FAILED_BOARD_NOT_EXIST(1202,"找不到该板块,板块号不存在"),
    FAILED_BOARD_BANNED(1203,"当前板块状态异常!"),
    FAILED_BOARD_ARTICLE_DELETE(1204,"删除该板块帖子失败"),

    //帖子相关
    FAILED_USER_ARTICLE_COUNT(1301,"更新帖子数量失败"),
    FAILED_ARTICLE_NOT_EXIST(1302,"找不到该帖子,或帖子已被删除"),
    FAILED_ARTICLE_UPDATE(1303,"更新帖子失败"),
    ARTICLE_IS_BANNED(1304,"当前帖子状态异常!"),
    FAILED_ARTICLE_DELETE(1305,"删除帖子失败"),

    //帖子回复
    FAILED_REPLY_IS_NULL(1401,"回复帖子参数为空!"),
    FAILED_REPLY(1402,"回复出现异常!"),
    FAILED_MESSAGE_NOT_EXIST(1302,"找不到该帖子,或帖子已被删除"),

    //站内信息
    FAILED_SEND_MESSAGE(1501,"发送站内信失败"),
    RECEIVER_NOT_EXIST(1502,"接收方状态异常!"),
    CAN_NOT_SEND_TO_YOURSELF(1503,"禁止向自己发送站内信!"),
    MESSAGE_NOT_YOURSELF(1504,"该站内信非该用户所有!"),
    MESSAGE_NOT_EXIST(1505,"站内信不存在!"),


    //更新用户头像
    UPDATE_AVATAR_IS_EMPTY(1601,"上传的头像为空!"),
    FAILED_UPDATE_AVATAR(1602,"更新头像失败!"),
    FAILED_UPDATE_AVATAR_oversize(1603,"图片过大,无法修改!文件不能超过2MB"),


    //其他
    ERROR_SERVICES(2000, "服务器内部错误"),
    ERROR_IS_NULL(2001, "IS NULL");

    // 状态码
    int code;

    // 状态描述
    String message;

    // 构造方法
    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "code = " + code + ", message = " + message + ", ";
    }
}
